package com.har.modules.web.controller;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.har.common.utils.R;
import com.har.modules.web.entity.BannerEntity;
import com.har.modules.web.service.BannerService;
import com.har.modules.web.service.BaseProducService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Hashtable;
import java.util.Map;


/**
 *  PC首页
 *
 * @author maorui
 *
 */
@RestController
@RequestMapping("/center")
public class CenterController {
    @Autowired
    private BannerService bannerService;
    @Autowired
    private BaseProducService baseProducService;

    /**
     * 首页初始化所有数据
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        Map<String,Object> map=new Hashtable<>();
        //查询banner数据
        map.put("banner",bannerService.selectList(
                new EntityWrapper<BannerEntity>().eq("status",1)));
        //贷款模块
        map.put("loan",baseProducService.queryLoan());
        //数据服务模块
        map.put("infoservice",baseProducService.queryInfoService());
        //智慧门店 只查询主表
        map.put("smartstore",baseProducService.querysmartstore(3));
        //保险
        map.put("insurance",baseProducService.queryInsurance());
        //企业金融政策
        map.put("financial",baseProducService.queryFinancial(5));
        return R.ok().put("data", map);
    }

}
